package com.soft.servlet;


import com.soft.entity.Goods;
import com.soft.service.Domain;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "DeleteGoodsServlet", urlPatterns = "/DeleteGoods")
public class DeleteGoodsServlet extends HttpServlet {
    private Domain domain;
  
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {


    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

        domain = new Domain();

        int id= Integer.parseInt(request.getParameter("goodsId"));

        if(domain.deleteGoods(id))
            request.getSession().setAttribute("flag",26);
        else
            request.getSession().setAttribute("flag",27);
        request.getRequestDispatcher("/GoodsList").forward(request, response);
    }
}
